﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ZH.Infrastructure.Dto.Response.admin;
using ZH.Service.Interface;

namespace ZH.Api.Admin.Controllers
{

    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BaseController : ControllerBase
    {

        protected readonly I_Login_Service _login_Service;

        /// <summary>
        ///     
        /// </summary>
        /// <param name="login_Service"></param>
        public BaseController(I_Login_Service login_Service)
        {
            _login_Service = login_Service;
            //Thread.Sleep(Config.GetRandom(500, 1000));
        }


        /// <summary>
        /// 获取当前登录对象
        /// </summary>
        /// <returns></returns>
        protected User_Response_Dto Get_Current_User()
        {
            var code = Response.HttpContext.User.Identity?.Name;
            //var account = Response.HttpContext.User.FindFirstValue(ClaimTypes.Actor);
            return _login_Service.Check_Login(code, "");
        }

    }
}
